package com.shaozg.studydemo;

import com.shaozg.studydemo.control_activity.CheckBoxActivity;
import com.shaozg.studydemo.control_activity.EditTextActivity;
import com.shaozg.studydemo.control_activity.RadioBtnActivity;
import com.shaozg.studydemo.control_activity.TextViewActivity;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class ControlActivity extends Activity implements OnClickListener {
	private Button mTextViewBtn;
	private Button mEditTextBtn;
	private Button mRadioBtn;
	private Button mChkBoxBtn;
	private Button mSpinnerBtn;
	private Button mSeekBarBtn;
	private Button mDatePickerBtn;
	private Button mTimePickerBtn;
	private Button mProgressBarBtn;
	private Button mProgressDialogBtn;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_control);
		
		mTextViewBtn = (Button)findViewById(R.id.control_tv_btn);
		mTextViewBtn.setOnClickListener(this);
		
		mEditTextBtn = (Button)findViewById(R.id.control_edit_text_btn);
		mEditTextBtn.setOnClickListener(this);
		
		mRadioBtn = (Button)findViewById(R.id.control_radio_btn);
		mRadioBtn.setOnClickListener(this);
		
		mChkBoxBtn= (Button)findViewById(R.id.control_checkbox_btn);
		mChkBoxBtn.setOnClickListener(this);
		
		mSpinnerBtn= (Button)findViewById(R.id.control_spinner);
		mSpinnerBtn.setOnClickListener(this);
		
		mSeekBarBtn= (Button)findViewById(R.id.control_seek_bar);
		mSeekBarBtn.setOnClickListener(this);
		
		mDatePickerBtn= (Button)findViewById(R.id.control_date_picker);
		mDatePickerBtn.setOnClickListener(this);
		
		mTimePickerBtn= (Button)findViewById(R.id.control_time_picker);
		mTimePickerBtn.setOnClickListener(this);
		
		mProgressBarBtn= (Button)findViewById(R.id.control_progress_bar);
		mProgressBarBtn.setOnClickListener(this);
		
		mProgressDialogBtn= (Button)findViewById(R.id.control_progress_dialog);
		mProgressDialogBtn.setOnClickListener(this);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.control, menu);
		return true;
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		Intent intent = new Intent();
		switch (v.getId()) {
		case R.id.control_tv_btn:
			intent.setClass(this, TextViewActivity.class);
			startActivity(intent);
			break;
		case R.id.control_edit_text_btn:
			intent.setClass(this, EditTextActivity.class);
			startActivity(intent);
			break;
			
		case R.id.control_radio_btn:
			intent.setClass(this, RadioBtnActivity.class);
			startActivity(intent);
			break;
		case R.id.control_checkbox_btn:
			intent.setClass(this, CheckBoxActivity.class);
			startActivity(intent);
			break;
		case R.id.control_spinner:
			break;
		case R.id.control_seek_bar:
			break;
		case R.id.control_date_picker:
			break;
		case R.id.control_time_picker:
			break;
		case R.id.control_progress_bar:
			break;
		case R.id.control_progress_dialog:
			break;
		default:
			break;
		}
	}
}
